<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>修改密码-佳运通综合平台</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="../../static/css/font.css">
    <link rel="stylesheet" href="../../static/css/weadmin.css">
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>

<body>
<div class="weadmin-body">
    <form class="layui-form">
        <div class="layui-form-item">
            <label class="layui-form-label">用户名</label>
            <div class="layui-input-inline">
                <input type="text" name="userName" class="layui-input layui-disabled" readonly>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">旧密码<span class="we-red">*</span></label>
            <div class="layui-input-inline">
                <input type="password" name="oldPassword" lay-verify="required" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">新密码<span class="we-red">*</span></label>
            <div class="layui-input-inline">
                <input type="password" name="newPwd" lay-verify="required" autocomplete="off" class="layui-input">
            </div>
<!--            <div class="layui-form-mid layui-word-aux">-->
<!--                6到16个字符-->
<!--            </div>-->
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">确认密码<span class="we-red">*</span></label>
            <div class="layui-input-inline">
                <input type="password" name="newPwd2" required="" lay-verify="required" autocomplete="off"
                       class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <button class="layui-btn layui-btn-normal layui-btn-sm fr" lay-filter="resetOwnerPw" lay-submit>确定</button>
        </div>
    </form>
</div>
<script src="../../static/lib/layui/layui.js" charset="utf-8"></script>
<script>
    layui.extend({
        admin: '{/}../../static/js/admin',
        configs: '{/}../../static/js/config'
    }).use(['jquery','form', 'layer','configs'], function () {
        var $ = layui.jquery,
            form = layui.form,
            layer = layui.layer,
            config = layui.configs;
        //监听提交
        var userInfos = JSON.parse(sessionStorage.getItem('userInfos'));
        $("input[name='userName']").val(userInfos.userName);
        form.on('submit(resetOwnerPw)', function (res) {
            res.field.userId = userInfos.userId;
            $.ajax({
                url: config.baseUrl + "/platform/user/chg_pwd/v1.0",
                type: "post",
                datatype: "json",
                data: res.field,
                success: function (result) {
                    if(result.stateCode == 0){
                        layer.alert(result.stateMsg,function (index) {
                            parent.layer.close(index);
                            sessionStorage.clear();
                            window.top.location.reload();
                        });
                    }else{
                        layer.alert(result.stateMsg);
                    }
                }
            });
            return false;
        });

    });
</script>
</body>

</html>
